UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a8NDUZozF6dlzAkmZ/yTisV3C4wNz+WIaquzPDzZ6Xc=' 
WHERE 
  key_id = 'e79e06857b9dd9161fa339caae0da93fc5bf16712275b38565f9676a8d43dc9d' 
  AND (
    token = 'a8NDUZozF6dlzAkmZ/yTisV3C4wNz+WIaquzPDzZ6Xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023