UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L7E1kuAnejYZur0j3wlufMysWIhh5O/eQ4D5s4THDF4=' 
WHERE 
  key_id = 'b9d5d9e7969b7e45acaa686606454b584d52b7137fc9f1fb318c5e48a8c2b05a' 
  AND (
    token = 'L7E1kuAnejYZur0j3wlufMysWIhh5O/eQ4D5s4THDF4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028