UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LNbvSnBnXMRLKbQ4LVy8tvFBvCSxettQVSIEOvWKbL4=' 
WHERE 
  key_id = '58ada562868abf3b35fcbf755c269dea4215f33d4688170f7ca4901de5cec114' 
  AND (
    token = 'LNbvSnBnXMRLKbQ4LVy8tvFBvCSxettQVSIEOvWKbL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050