UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kChj7a0SzEMn6yu/ZqEZcLRZEZmQ8LtXz0Yw8F9YcOc=' 
WHERE 
  key_id = 'f569f35f9df05e9ff187b2e25312541c6e461627ec230a0164317b7f136e1d52' 
  AND (
    token = 'kChj7a0SzEMn6yu/ZqEZcLRZEZmQ8LtXz0Yw8F9YcOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026