UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lhO9IW8rFDIGPFu5wTBt000BnG6bdRwnQzlM93Lg0tg=' 
WHERE 
  key_id = 'a4cf73b4d0c43f553f9fd6d89b445dcb1f2f8c2ddfdee59507149455057fa8a2' 
  AND (
    token = 'lhO9IW8rFDIGPFu5wTBt000BnG6bdRwnQzlM93Lg0tg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040