UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N6woauJrjnwE9DO6XbT85lODgU03pzzTzLG7Z4R1XvY=' 
WHERE 
  key_id = '0b8c77451806fef4b9d67f2e61849a0be5b64e4f420fc9be8253bcf37b809237' 
  AND (
    token = 'N6woauJrjnwE9DO6XbT85lODgU03pzzTzLG7Z4R1XvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046