UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qj5559iNZtWuP1sSyRs+EqsaMawtOMKvlnecKHww4OY=' 
WHERE 
  key_id = '0594f27765faf9f4860c66acc2a2e8c63099d5751721fa022d8e704fc1852b63' 
  AND (
    token = 'qj5559iNZtWuP1sSyRs+EqsaMawtOMKvlnecKHww4OY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023