UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NnDHMNuOKLywjjxN1NiH+Wc1EY3E3IOOsfJxGAlSqCc=' 
WHERE 
  key_id = '35e531e7814e38b26d4567aa5acdad11df3f2222d7224db8c6011876400bef31' 
  AND (
    token = 'NnDHMNuOKLywjjxN1NiH+Wc1EY3E3IOOsfJxGAlSqCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032