UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p62eP95eqfYtPXNRcYhTmcB8ik677vhzAAazwIdAluQ=' 
WHERE 
  key_id = '36274e88a9901e7fa828bd9d8d2e11f761237f1b12b854267d4e29e21eacbe0c' 
  AND (
    token = 'p62eP95eqfYtPXNRcYhTmcB8ik677vhzAAazwIdAluQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017