UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BpxrSr95w2dJ3qURcFsHruU70cYo1UbaqNk81rs6Q0E=' 
WHERE 
  key_id = '05d20e74b2a0167788f7df3987f1422872def70e5061a3a84ccfc5d044f0934c' 
  AND (
    token = 'BpxrSr95w2dJ3qURcFsHruU70cYo1UbaqNk81rs6Q0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039