UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a1Czpgspgb26v9objupqEh41L3/UteqsAyq5aVWerjA=' 
WHERE 
  key_id = 'af2f781095b2c70cfbb496686383124b9c841286bd269705012197c09a0caccc' 
  AND (
    token = 'a1Czpgspgb26v9objupqEh41L3/UteqsAyq5aVWerjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042