UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ElvWhsCxAAkTFcUSCCXKpOeW8Zp/ZDkY5CFpMAl+mvQ=' 
WHERE 
  key_id = 'cf3a347d55bec56b31c0c7d39226865923037b153d91eabde545c60f8d4d7388' 
  AND (
    token = 'ElvWhsCxAAkTFcUSCCXKpOeW8Zp/ZDkY5CFpMAl+mvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058