UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g3Q4Ht/0jsKdHyII1wbgwAjzZEBt763YQuSc04An2R0=' 
WHERE 
  key_id = '339a9bae9a540515f7ff20202e3aa4076ca5518acafcdc4956b3998f399ae8d3' 
  AND (
    token = 'g3Q4Ht/0jsKdHyII1wbgwAjzZEBt763YQuSc04An2R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026