UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b3EuGGMX049dF2r+n3V0lMy7lyACutXkzupz3qqNQ88=' 
WHERE 
  key_id = 'ff95f7429710065cfcc8df4bd264e19d81e197db26d492033f35d188d66f6b6a' 
  AND (
    token = 'b3EuGGMX049dF2r+n3V0lMy7lyACutXkzupz3qqNQ88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019