UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UPK+qzVMJtlnlLL/tk7rRFI1xTHZGPUZH0e/x/yV6cI=' 
WHERE 
  key_id = '241979d89161d11970966b6bff92a79136bb53839f23174384e7fa028b9ace2e' 
  AND (
    token = 'UPK+qzVMJtlnlLL/tk7rRFI1xTHZGPUZH0e/x/yV6cI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052