UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vbNQ5wa/YGwuh9F1WF+pmzjz2vhsk7RzP4lacR0q6oE=' 
WHERE 
  key_id = 'db8c1caf900b0a81214e86f53e6441d8de6e483199f251080bcede7beac84934' 
  AND (
    token = 'vbNQ5wa/YGwuh9F1WF+pmzjz2vhsk7RzP4lacR0q6oE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046