UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wWU/INg5Tjym1ag9QECC6ZSzf1DVWPcVWtkZuXn5Zuw=' 
WHERE 
  key_id = '7da4da01e922200893a05c5ad6028855253972a86a8baffc1002cab778a386fc' 
  AND (
    token = 'wWU/INg5Tjym1ag9QECC6ZSzf1DVWPcVWtkZuXn5Zuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044