UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rHtcNUjCgx05YpCNdpxep9vFl8PU8JNJ1/wvJCqTgwE=' 
WHERE 
  key_id = 'f253e23e41f5dde979f25ea0ab94ef62de150f50109523eb12f01f440052ce76' 
  AND (
    token = 'rHtcNUjCgx05YpCNdpxep9vFl8PU8JNJ1/wvJCqTgwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062