UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8lN4gUBobByVOuXmLIn9LebfuCick+4kuZ4nrLQQDMU=' 
WHERE 
  key_id = '59b30df175592c7f459867a8c8be38c49d2d8ab0f3e4b81d5a78787d7958f094' 
  AND (
    token = '8lN4gUBobByVOuXmLIn9LebfuCick+4kuZ4nrLQQDMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040