UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VkGoO20i6Lr/X8L+TUZ+oFcy4CPW5FJz/MwiIAvREAo=' 
WHERE 
  key_id = 'dad8102254d785c60132dd51afd3038c6461d292af4f8cb9e1d1b138df9f4904' 
  AND (
    token = 'VkGoO20i6Lr/X8L+TUZ+oFcy4CPW5FJz/MwiIAvREAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038