UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8aluD0l9Di8gm5XN3gXykGqKjI1PfEchg1ejOLMHF0k=' 
WHERE 
  key_id = 'ee5892c20dd0466f566cee26938dd226366862dfbadcb14a3171a1de3a896956' 
  AND (
    token = '8aluD0l9Di8gm5XN3gXykGqKjI1PfEchg1ejOLMHF0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038