UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zj9r+p4olgIg1jtUKVEBmYtyO+eOOfL5uZFajiuHPYc=' 
WHERE 
  key_id = 'c52c7c195e8d14ef0c4e92235f1c3702594e6187640e749c5c532ef677210f26' 
  AND (
    token = 'Zj9r+p4olgIg1jtUKVEBmYtyO+eOOfL5uZFajiuHPYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018