UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZriooZY546+d4q0hIzUiNJi2SLQKDkWOJPZPhFnG2CQ=' 
WHERE 
  key_id = '802c1911b3e8229ff873ed85045e5da76d43c62eadbec03d0d879e0544afa945' 
  AND (
    token = 'ZriooZY546+d4q0hIzUiNJi2SLQKDkWOJPZPhFnG2CQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019