UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kStqJWKTfrqsqhv12qigQtHXrpnLvuUFhurWygAXy8U=' 
WHERE 
  key_id = '067d1ae35594f735821988daf9c5c5e7a24fa75c832737b75d512b0eb7b05aae' 
  AND (
    token = 'kStqJWKTfrqsqhv12qigQtHXrpnLvuUFhurWygAXy8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037