UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z+ajqDgAX0SXhy2vLo4De0B1JDPsYS83YrxLD6nDPvU=' 
WHERE 
  key_id = '0eba733a870bd48240289af854e40dfd7ab930e29b23b2c779149786a2da7c02' 
  AND (
    token = 'z+ajqDgAX0SXhy2vLo4De0B1JDPsYS83YrxLD6nDPvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042