UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XnLAKr+fw4FGiDRrdYyW0iVxrJxQqRiPv6w7x964sqM=' 
WHERE 
  key_id = 'b0f1d04b8fde7b06a56e4dbc4933a40ad96b5e0867f6cffbc84c4cfe98967e21' 
  AND (
    token = 'XnLAKr+fw4FGiDRrdYyW0iVxrJxQqRiPv6w7x964sqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034