UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aTmMqoNw+5JTZuzBl61eFEzCyBmirn/bTx8K0wnmnZ8=' 
WHERE 
  key_id = '26f64e226607b0091ce56f50430815294df7eb16f5f46950de52a6d16fbdd511' 
  AND (
    token = 'aTmMqoNw+5JTZuzBl61eFEzCyBmirn/bTx8K0wnmnZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034