UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6NfAAkourwdF0099vt9HMESzwX/Z4nNdNVtHpIVgZQc=' 
WHERE 
  key_id = '8f5805d8945cc4d5dc31ed7d54f14386227c415e3a395ae8ebd27eb19680f445' 
  AND (
    token = '6NfAAkourwdF0099vt9HMESzwX/Z4nNdNVtHpIVgZQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029