UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qfPc4GJqEAu9CXWYxUBW1byAJEhly2q7WQmbCAkNFmQ=' 
WHERE 
  key_id = '4b9618af93bd9277c9688ba9f2d40f0348638fd4fe033919e6e0c401fbe1f99a' 
  AND (
    token = 'qfPc4GJqEAu9CXWYxUBW1byAJEhly2q7WQmbCAkNFmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023