UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Axx5Tyf9d/80+SaePeP2mSb6EhdUiLT/kRa0J7TswRw=' 
WHERE 
  key_id = '4728aed6e661b2788d690986a518d983afa9e68e54ee8f2e47fabe656856a0c5' 
  AND (
    token = 'Axx5Tyf9d/80+SaePeP2mSb6EhdUiLT/kRa0J7TswRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052