UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'seZzY2jA2lO/joT1/96sCbij1s4EGzky0i/hcDo4ZvU=' 
WHERE 
  key_id = '8ddb09e8031a813de6d91c81d408488b619422c98701252b03d9939c860df95f' 
  AND (
    token = 'seZzY2jA2lO/joT1/96sCbij1s4EGzky0i/hcDo4ZvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030